
import unittest
import pytest

import os
import pytest
# 多重断言：单个测试中可以执行多个断言
# 不会中断：即使断言失败也会继续执行
# 完整报告：最终会显示所有失败的断言
from pytest_assume.plugin import assume
from common.request import Requests
from common.db import db
from common.login import Login
from common.header.Header import Headers
import os
from common.backup_roll import db_backup_reset
from ddt import file_data,ddt

<<<<<<< HEAD
class TestCase:
    def test_something(self):
        self.assertEqual(True, False)  # add assertion here
=======
@ddt
class MyTestCase(unittest.TestCase):
    BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    DATA_FILE = os.path.join(BASE_DIR, 'data', 'data02.yaml')
    #数据库断言
    def test_sql(self):
        login = Login()
        header = Headers().headers()
        print(header)
        data={"billDay":"2025-5-25"}
        res=Requests(headers=header).post_request(url='/boss/reconciliation/list/checkbatch', data=data)
        print('------------------------------------')
        print(res.url)
        print(res.text)
        print(res.cookies)
        print("*************************************")
        data=db().query("select status from rp_account_check_batch where status = 'ERROR'")
        print(data[0][0])
        assume(data[0][0] in 'ERROR')


    @file_data(DATA_FILE)
    def test_can(self,bill_data):
        login = Login()
        login.login("这是添加权限")
        header = Headers().headers()
        print(header)
        data = {"billDay": bill_data}
        res = Requests(headers=header).post_request(url='/boss/reconciliation/list/checkbatch', data=data)
        print('------------------------------------')
        print(res.url)
        print(res.text)
        print(res.cookies)
>>>>>>> cfd41fdefb1b8c4bb914e3067fbd890c471b8397


if __name__ == '__main__':
    unittest.main()
from common.backup_roll import db_backup_reset
from ddt import ddt, file_data
@ddt
class TestCase:
    BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    DATA_FILE = os.path.join(BASE_DIR, 'data', 'user.yaml')
    print("-->",DATA_FILE)

from common.backup_roll import db_backup_reset
from ddt import ddt, file_data
@ddt
class TestCase:
    BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    DATA_FILE = os.path.join(BASE_DIR, 'data', 'user.yaml')
    print("-->",DATA_FILE)

    @file_data(DATA_FILE)
    def test_add(self,userName,mobile,case,exp):
        login = Login()
        login.login("用户添加")
        headers = Headers().headers()
        data = {"navTabId":"yhxx","callbackType":"closeCurrent","forwardUrl":"","userName":userName,"mobile":mobile,"password":"123456"}
        res = Requests(headers=headers).post_request(url='/boss/user/info/add',data=data)
        print(res.text)
        if exp == "正向":
            assume(res.status_code == 200)
            print(case)
            print(case)
